local lsp_wenya = fk.CreateSkill {
    name = "lsp_wenya",
}

Fk:loadTranslationTable {
    ["lsp_wenya"] = "炆哑",
    [":lsp_wenya"] = "出牌阶段限一次，你可以交给一名其他角色一张非基本牌，令其回复一点体力并重置武将牌，若其判定区内有牌，你获得并重铸这些牌。",
}

lsp_wenya:addEffect("active", {
    anim_type = "support",
    card_num = 1,
    target_num = 1,
    can_use = function(self, player)
        local ids = #table.filter(player:getCardIds("h"), function(u) return Fk:getCardById(u).type ~= Card.TypeBasic end)
        return player:usedSkillTimes(lsp_wenya.name, Player.HistoryPhase) == 0 and not player:isKongcheng() and ids > 0
    end,
    card_filter = function(self, player, to_select, selected)
        return #selected == 0 and Fk:getCardById(to_select).type ~= Card.TypeBasic
    end,
    target_filter = function(self, player, to_select, selected)
        return #selected == 0 and to_select ~= player
    end,
    on_use = function(self, room, effect)
        local player = effect.from
        local target = effect.tos[1]
        room:obtainCard(target, effect.cards[1], false, fk.ReasonGive, player, lsp_wenya.name)
        room:recover({
            who = target,
            num = 1,
            recoverBy = player,
            skillName = lsp_wenya.name,
        })
        target:reset()
        if #target:getCardIds("j") > 0 then
            local cards = target:getCardIds("j")
            room:moveCardTo(cards, Card.PlayerHand, player, fk.ReasonPrey, lsp_wenya.name, nil, false, player)
            room:recastCard(cards, player, lsp_wenya.name)
        end
    end,
})

return lsp_wenya
